package br.com.foxinline.modelo.ep;

import br.com.foxinline.modelo.TipoSelo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author cadomeireles
 */
@Entity
public class SeloEP implements Serializable {

    @Id
    @SequenceGenerator(sequenceName = "seq_seloep", name = "seq_seloep", allocationSize = 1)
    @GeneratedValue(generator = "seq_seloep", strategy = GenerationType.SEQUENCE)    
    private Long id;

    private String serie;
    
    private Integer numero;
    
    @OneToOne
    private TipoSelo tipoSelo;

    public SeloEP() {}

    public SeloEP(Long id, String serie, Integer numero, TipoSelo tipoSelo) {
        this.id = id;
        this.serie = serie;
        this.numero = numero;
        this.tipoSelo = tipoSelo;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }

    public String getSerie() {
        return serie;
    }

    public void setSerie(String serie) {
        this.serie = serie;
    }

    public TipoSelo getTipoSelo() {
        return tipoSelo;
    }

    public void setTipoSelo(TipoSelo tipoSelo) {
        this.tipoSelo = tipoSelo;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final SeloEP other = (SeloEP) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.serie == null) ? (other.serie != null) : !this.serie.equals(other.serie)) {
            return false;
        }
        if (this.numero != other.numero && (this.numero == null || !this.numero.equals(other.numero))) {
            return false;
        }
        if (this.tipoSelo != other.tipoSelo && (this.tipoSelo == null || !this.tipoSelo.equals(other.tipoSelo))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 67 * hash + (this.serie != null ? this.serie.hashCode() : 0);
        hash = 67 * hash + (this.numero != null ? this.numero.hashCode() : 0);
        hash = 67 * hash + (this.tipoSelo != null ? this.tipoSelo.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "SeloEP{" + "id=" + id + ", serie=" + serie + ", numero=" + numero + ", tipoSelo=" + tipoSelo + '}';
    }

}
